
/**
 * @className User
 * @author sjw
 * @date 2020/11/13 16:32
 * @description: TODO
 */
class User(argName: String, argAge: Int){
  var name: String =argName;
  var age: Int=argAge;
  def sayHello(): Unit ={
    print("hello,I am ",name," ",age)
  }

}



object main {

  def main(args: Array[String]): Unit = {
    //delayed1(time())
    //delayed2(time())

    var user=new User("sjw",32)
    user.sayHello()

  }


  def add(a:Int,b:Int):Int={
    var sum:Int=0;
    sum=a+b;
    sum
  }

  def sub(a:Int,b:Int): Unit ={

  }


  def time()={
    println("获取时间")
    System.nanoTime()
  }
// 传名调用
  def delayed1(t: =>Long)={
    println("--delayed1--")


    println("参数"+t)

  }

  def delayed2(t:Long)={
    println("--delayed2--")
    println("参数"+t)
  }


}
